<template>
	<view>

	<view class="loginInfo">
		<view class="">
			所在分组：分类处置组
		</view>
		<view class="">
			<text>账号昵称：flczz1,</text>
			<text>退出</text>
		</view>
	</view>
		<view class="notice-bar" @click="getMore">
			<uni-notice-bar scrollable show-icon single show-get-more text="您有一条新消息，请点击进行查看"></uni-notice-bar>
		</view>

		<view class="card-group">
			<view class="card-box-item" v-for="(item,index) in menuList" :key="index">
				
				<view class="content" v-for="(key,val) in item" @tap="goCurrentPage(key.to)">
					
					<image :src="key.img" style="width: 50rpx;" mode="widthFix"></image>
					<text>{{key.name}}</text>
				</view>
				
			</view>
		</view>


	</view>
</template>

<script>
	import {
		log
	} from '../../common/util.js'
	import {
		toast,
		signOut,
		getStorageSync,
		useRouter
	} from '../../utils/utils.js'


	export default {

		data() {
			return {
				token: getStorageSync('token') || null,
				menuList: [
					[{
							name: '伤员登记',
							to: '/pages/wounded/index',
							img: '../../static/icons/hz2.png'
						},
						{
							name: '医嘱列表',
							to: '/pages/doctorsAdvice/index',
							img: '../../static/icons/hz3.png'
						},
						{
							name: '伤员列表',
							to: '/pages/casualtyList/index',
							img: '../../static/icons/hzlb2.png'
						},

						
					],
					[
						{
							name: '病情诊断记录',
							to: '/pages/illness/index',
							img: '../../static/icons/illness.png'
						},
						{
							name: '后送管理列表',
							to: '/pages/evacuation/index',
							img: '../../static/icons/hswz2.png'
						},
						{
							name: '组物资管理',
							to: '/pages/goodsManager/index',
							img: '../../static/icons/hzlb3.png'
						}
					],
					[
						{
							name: '后送记录',
							to: '/pages/evacuationRecording/index',
							img: '../../static/icons/zhuangche.png'
						},
						{
						
							name: '护理记录',
							to: '/pages/nursing/index',
							img: '../../static/icons/hs.png'
						},
					]
					// {
					// 	name: '患者流转',
					// 	to: '',
					// 	img: '../../static/icons/change.png'
					// }
				]
			}
		},

		onLoad() {
			if (typeof(this.token) === 'boolean') {
				uni.setTabBarItem({
					index: 1,
					visible: false
				})

			} else {
				uni.setTabBarItem({
					index: 1,
					visible: true
				})
			}

		},
		onTabItemTap() {
			const token = getStorageSync('token') || null


			if (!token) {
				signOut()
				toast('请先登录后在使用!')
			}
		},
		methods: {
			goCurrentPage(to){
				useRouter(to,{},'navigateTo')
			},
			//根据登录状态，展示不同的按钮
			filtersMenuList() {
				if (typeof(this.token) === 'string') {
					// 账号密码登录状态
					return this.menuList

				} else {
					// 离线登录状态
					return this.menuList.filter((item, index) => index === 0)
				}
			}


		}
	}
</script>


<style lang="scss">
	.notice-bar {
		width: 100%;
		height: 100%;
	}
	.loginInfo{
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 20rpx 30rpx;
		font-size: 24rpx;
		color: #666;
	}
	.card-group {
		margin: 32rpx;

		.card-box-item {
			height: 220rpx;
			width: 100%;
			background-color: #efefef;
			border-radius: 20rpx;
			box-shadow: inset 0rpx -10rpx 40rpx #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: space-around;
			margin-bottom: 20rpx;

			.content {
				text-align: center;

				&>text {
					display: block;
					font-size: 28rpx;
				}
			}
		}
	}

	.box {

		margin: 30px;

		.icon {
			width: 50px;
			height: 50px;
			border: 1px solid #1a2e05;
			justify-content: center;
			border-radius: 8px;
			background-color: #1a2e05;

			font-size: 12px;
			display: flex;
			flex-direction: column;
			align-items: center;
		}
	}
</style>